package com.mkyong.app;

import java.util.List;

import com.hp.hpl.jena.rdf.model.Model;

public class QueryExecutor {

	String queryString = " PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
			+ " PREFIX owl: <http://www.w3.org/2002/07/owl#> "
			+ " PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
			+ " PREFIX : <http://www.semanticweb.org/muhammadaslam/ontologies/2014/1/untitled-ontology-32#> "
			+ " PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
			+ " SELECT * WHERE { :Ola :hasGivenName  ?Given_Name . :Ola :hasFamilyName  ?Family_Name  } ";

	public QueryExecutor() {

	}

	public QueryExecutor(String queryString) {
		this.queryString = queryString;
	}

	public List<Node> getFromRelationalStore() {
		CustomStore store = new RelationalStore();

		Model model = store.getDefaultModel();
		return store.executeQuery(queryString, model);
	}

	public List<Node> getFromTripleStore() {
		CustomStore store = new TripleStore();

		return store.executeQuery(queryString, store.getDefaultModel());
	}

	public List<Node> getFromOwlFileStore() {
		CustomStore store = new OwlFileStore();
		return store.executeQuery(queryString, store.getDefaultModel());

	}

}
